package models;

/**
 *
 * @author Merete, Mirna, Esben, Knut og Stian
 *
 */
public class Score implements Comparable<Score> {

	private String user;
	private int score;

	public Score(String username){
		this.user = username;
		this.score = 0;
	}

	public String getUser(){
		return user;
	}

	public void setUser(String name){
		this.user = name;
	}

	public int getScore(){
		return this.score;
	}

	public void addPoints(int d){
		this.score += d;
	}

	public void resetScore(){
		score = 0;
	}

	public void setScore(int i){
		score = i;
	}


	@Override
	public String toString() {
		return String.valueOf(getUser()+": "+getScore());
	}

	@Override
	public int compareTo(Score another) {
		if(this.score == another.score){
			return 0;
		}
		else if(this.score > another.score){
			return -1;
		}
		else{
			return 1;
		}
	}


}
